#pragma once

#include "BasicWindow.h"
#include "ui_CCMainWindow.h"
#include "SkinWindow.h"

class CCMainWindow : public BasicWindow
{
	Q_OBJECT

public:
	CCMainWindow(const QString& account, QWidget *parent = Q_NULLPTR);
	~CCMainWindow();

private:
	void init(); 
	void initButton();
	void initAppButton();
	void initLevelButton();
	void initConnect();
	void initContact();
	void initSysTray();

	void drawButtonIcon(QPushButton* btn, const QString& filePath);
	QPushButton* addOtherButton(const QString& iconPath, 
							const QString& objName, 
							QSize size = QSize(20, 20));
	void drawLevelButton(int level);

	void updateSearchStyle(bool hasFocus);

	void setUserName();
	void setUserHeadPixmap();

	void addUserGroup(QTreeWidgetItem* root);

protected:
	bool eventFilter(QObject* watched, QEvent* event) override;

private slots:
	void onButtonClicked();

	void onTreeItemClicked(QTreeWidgetItem* item);
	void onTreeItemDoubleClicked(QTreeWidgetItem* item);
	void onTreeItemExpanded(QTreeWidgetItem* item);
	void onTreeItemCollapsed(QTreeWidgetItem* item);

	void onQuit();

private:
	Ui::CCMainWindowClass ui;
	QString account;
	static int level;
	/*SkinWindow* skinWindow;*/
};
